#ifndef FUDP_SENDER
#define FUDP_SENDER

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>

#include "common_conf.hpp"


class FUDP_Sender
{
private:
    int socket_id;
    struct sockaddr_in dst_address;
    string srcName;

    // the last unack packet
    int sendBase;
    // the next packet to send
    int nextSeqNum;

    //sendBase's index in window
    int sendBaseIndex;

    // the buffer
    char window[sender_window_size][max_datagram_size+10];

    int window_size[sender_window_size];

public:
    // init the sender
    FUDP_Sender(int _socket_id,struct sockaddr_in _dst_address, const char* filename);

    // send and return result
    bool send();
};


#endif // !FUDP_SENDER

